package com.project.controller;

import com.project.entity.qo.CardQo;
import com.project.result.ResponseResult;
import com.project.service.CardService;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @ProjectName:
 * @Package:
 * @ClassName:
 * @Author: ZhaoLongShi
 * @CreateDate:
 */
@SuppressWarnings("all")
@RestController
@RequiresRoles("admin")
@RequestMapping("/card")
public class CardController {
    @Resource
    private CardService cardService;

    @GetMapping("/select/all/card")
    public ResponseResult selectAllCard() {
        ResponseResult result = cardService.selectAllCard();
        return result;
    }

    @PostMapping("delete/card")
    public ResponseResult deleteCard(Long cardId) {
        ResponseResult result = cardService.deleteCard(cardId);
        return result;
    }

    @PutMapping("add/card")
    public ResponseResult addCard(@RequestBody CardQo cardQo) {
        ResponseResult result = cardService.addCard(cardQo);
        return result;
    }

    @PostMapping("update/card")
    public ResponseResult updateCard(@RequestBody CardQo cardQo) {
        ResponseResult result = cardService.updateCard(cardQo);
        return result;
    }
}
